/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package action.retail;

import static com.opensymphony.xwork2.Action.SUCCESS;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import java.util.Map;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.Result;

/**
 *
 * @author Thai Ha Cong
 */
@Namespace("/Member")
public class LogoutAction extends ActionSupport {
    
    public LogoutAction() {
    }
    
    @Override
    public String execute() throws Exception {
        return  SUCCESS;
    }
    
    //create new
    @Action(value = "logout", results = {
        @Result(name = "success", location = "/index.jsp")
    })
    public String logout() throws Exception {
        Map session = ActionContext.getContext().getSession();
        session.remove("username");
        session.remove("currentCustomer");
        return SUCCESS;
    }
}